#*--encoding:UTF-8--*
'''
乐活e生2019重大疾病保险
'''

'''
整理数据
'''
from common.config import *
from db.mysql import MysqlClient
from common.helper import Helper

class Arrangement( object ):

    def __init__(self):
        self.name = "乐活e生2019重大疾病保险"
        self.mysql = MysqlClient()

    def pullData(self, data={}):

        for item in Helper.selectData(self.name, self.mysql):

            if item["packageCode"] == "PACK190678300001":
                majorDisease = "10w"
                specialDisease = "10w"
                slightDisease = "2w"
            elif item["packageCode"] == "PACK190678300002":
                majorDisease = "20w"
                specialDisease = "20w"
                slightDisease = "4w"
            elif item["packageCode"] == "PACK190678300003":
                majorDisease = "25w"
                specialDisease = "25w"
                slightDisease = "5w"
            elif item["packageCode"] == "PACK190678300004":
                majorDisease = "30w"
                specialDisease = "30w"
                slightDisease = "6w"
            elif item["packageCode"] == "PACK190678300004":
                majorDisease = "40w"
                specialDisease = "40w"
                slightDisease = "8w"
            else:
                majorDisease = "50w"
                specialDisease = "50w"
                slightDisease = "10w"

            if item["extra_product"] == "1012005":
                seriousCancer = "100w"
            else:
                seriousCancer = ""

            data["name"] = self.name
            data["company"] = "众安保险"
            data["year"] = item["year"]
            data["gender"] = "1" if item["gender"]=="男" else "0"
            data["expire"] = item["expire"]
            data["price"] = item["price"]
            data["payType"] = "年交"
            data["majorDisease"] = majorDisease
            data["specialDisease"] = specialDisease
            data["slightDisease"] = slightDisease
            data["seriousCancer"] = seriousCancer
            Helper.mergeTable( self.name,self.mysql,data )
